#include <gtest/gtest-typed-test.h>
#include <gtest/gtest.h>

// 1. 定义模板类
template <typename T>
class TypedTestDemo : public testing::Test {};

// 2. 实例化模板类
using MyTypes = testing::Types<int, double, float>;
TYPED_TEST_SUITE(TypedTestDemo, MyTypes);

// 3. 定义测试用例
TYPED_TEST(TypedTestDemo, Add) {
    TypeParam a = 1;
    TypeParam b = 2;
    TypeParam c = a + b;
    EXPECT_EQ(c, 3);
}

struct A {
    char a;
    short b;
};

// 1. 定义测试用例
template <typename T>
class TypeSizeTest : public testing::Test {};

// 2. 实例化模板类
using MyTypes2 = testing::Types<int, unsigned int, int32_t, A>;
TYPED_TEST_SUITE(TypeSizeTest, MyTypes2);

// 3. 定义测试用例
TYPED_TEST(TypeSizeTest, TypeSizeTest) {
    EXPECT_EQ(sizeof(TypeParam), sizeof(int));
}